home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / _STREROR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  544 b   |  23 lines

  1. /* strerror.c  From TC Bible page 283  Use __strerror to construct an error
  2. message consisting of your message concatenated with a system message
  3. corresponding to the last error that occured in a library routine */
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <io.h>
  8. #include <string.h>
  9. main()
  10. {
  11.     int handle=100;
  12.     char *errmsg;
  13.  
  14.     /* Generate an error condition by attempting to duplicate a unused
  15.     file handle 100 */
  16.  
  17.     if(dup(handle) == -1)
  18.     {
  19.         errmsg = _strerror("Error duplicating handle");
  20.         printf(errmsg);
  21.     }
  22.  
  23. }